<?php
/**
 * Created by PhpStorm.
 * User: 刘凯龙
 * Date: 2018/9/3
 * Time: 10:37
 */
use yii\helpers\Html;
use yii\grid\GridView;
use \yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Check';
$this->params[ 'breadcrumbs' ][] = $this->title;
?>
<div class = "wrapper wrapper-content animated fadeInRight">
    <div class = "row">
        <div class = "col-sm-12">
            <div class = "ibox float-e-margins">
                <div class = "ibox-content">
                    <div class="img-box" style="position: fixed;z-index: 100;background: #232321;display: none;height:90%;width: 40%;">
                        <img src=""  style="height:100%;width: 100%;">
                    </div>
                    <div class = "table-responsive">
                        <?= GridView::widget( [
                            'dataProvider'  => $dataProvider ,
                            'filterModel'   => $searchModel ,
                            'layout'        => '{summary}{items}<div class="text-right tooltip-demo">{pager}</div>' ,
                            'rowOptions'    => [ 'class' => 'text-center' ] ,
                            'pager'         => [
                                'firstPageLabel' => "首页" ,
                                'prevPageLabel'  => '上一页' ,
                                'nextPageLabel'  => '下一页' ,
                                'lastPageLabel'  => '尾页' ,
                            ] ,
                            'columns'       => [
                                [
                                    'class' => 'yii\grid\SerialColumn' ,
                                    'headerOptions' => [  'style' => ['width' => '60','color'=>'#337ab7' ]] ,
                                ] ,
                                'project_name',
                                'name',
                                'model',
                                'request_time',
                                'request_num',
                                [
                                    'label'         => '图片' ,
                                    'format'        => 'raw' ,
                                    'filter'        => FALSE ,
                                    'value'         => function ( $model ) {
                                        return Html::img( IMG_URL . $model->image , [
                                            'style' => 'width:65px;height:50px;' ,
                                        ] );
                                    } ,
                                    'headerOptions' => [  'style' => ['width' => '60','color'=>'#337ab7' ]] ,
                                ] ,
                                'buy_time',
                                'price',
                                'all_price',
                                'salvage',
                                'reason',

                                [
                                    'header'        => '操作',
                                    'class'         => 'yii\grid\ActionColumn' ,
                                    'template'      => '{scrap-pass}  {scrap-veto}' ,
                                    'headerOptions' =>  [  'style' => ['width' => '60','color'=>'#337ab7' ]] ,
                                    'buttons'       => [
                                        'scrap-pass' => function ( $url , $model , $key ) {
                                            if($model->status == 1){
                                                return Html::a( '通过' , [
                                                    'scrap-pass' ,
                                                    'id'  => $model->id ,
                                                    'gid' => $model->gid ,
                                                ] , [
                                                    'class' => "btn btn-xs btn-success" ,
                                                    'data'  => [
                                                        'confirm' => '确定要通过吗？' ,
                                                        'method'  => 'post' ,
                                                    ] ,
                                                ] );
                                            }
                                        } ,
                                        'scrap-veto' => function ( $url , $model , $key ) {
                                            if($model->status == 1) {
                                                return Html::a('否决', [
                                                    'scrap-veto',
                                                    'id' => $model->id,
                                                ], [
                                                    'class' => "btn btn-xs btn-danger",
                                                    'data' => [
                                                        'confirm' => '确定要否决吗？',
                                                        'method' => 'post',
                                                    ],
                                                ]);
                                            }
                                        } ,
                                    ] ,
                                ] ,
                            ] ,
                        ] ); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="application/javascript" src="/js/public.js"></script>
<script type="application/javascript">
    imageMax();
</script>
